#define _CRT_SECURE_NO_WARNINGS 1
int majorityElement(int* nums, int numsSize) {
	int tmp[100] = { 0 };
	int i = 0;
	while (i<numsSize) {
		if (tmp[*nums] == nums[i]) {
			tmp[*nums]++;
			if (tmp[*nums] > (float)(numsSize / 2)) {
				return nums[i];
			}
		}
		else
		tmp[*nums] = nums[i];
		i++;
	}
	return 0;
}
#define _CRT_SECURE_NO_WARNINGS 1
int majorityElement(int* nums, int numsSize) {
	int count = 1;
	int tmp = nums[0];
	for (int i = 1; i < numsSize; i++) {
		if (tmp == nums[i]) {
			count++;
		}
		else count--;
		if (count == 0) tmp = nums[i + 1];
	}
	return tmp;
}
//